package awk.javarmiiiop;


import awk.javarmi.Message;

import javax.rmi.PortableRemoteObject;
import java.rmi.RemoteException;

/**
 * 继承了 PortableRemoteObject 同时需要继承 Remote,因为不能继承两个类,所以实现接口
 */
public class HelloImpl extends PortableRemoteObject implements HelloInterface {
    /**
     * Initializes the object by calling <code>exportObject(this)</code>.
     *
     * @throws RemoteException if export fails.
     */
    public HelloImpl() throws RemoteException {
    }

    @Override
    public void sayHello(Message msg) throws RemoteException {
        System.out.println("Hello from " + msg.getMessage() + "!!");
    }
}
